package cn.it.services.impl;

import cn.it.domain.HjLog;
import cn.it.mapper.CustomerItemMapper;
import cn.it.mapper.HJLogMapper;
import cn.it.services.ISearchServices;
import cn.it.util.CustomerNameAndId;
import cn.it.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class SearchServicesImpl implements ISearchServices {
    @Autowired
    private HJLogMapper hjLogMapper;
    @Autowired
    private CustomerItemMapper customerItemMapper;
    @Override
    public Result searchCustomerById(Integer checkCode) {
        if(checkCode == null){
            return new Result(201,"服务层未接收到用户Id",null);
        }else {
            HjLog hjLog = hjLogMapper.searchCustomerById(checkCode);
            return new Result(200,"查询成功",hjLog);
        }
    }

    @Override
    public List<CustomerNameAndId> queryAllCustomer() {
        List<CustomerNameAndId> list = customerItemMapper.queryAllCustomer();
        System.out.println(list);
        return list;
    }
}
